package tech.aistar.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tech.aistar.entity.Film;

import java.util.List;

/**
 * 本类用来演示
 *
 * @author success
 * @date 2023/3/5 15:03:31
 */
@Repository
public interface FilmMapper {


    @Select("select * from mm_film")
    List<Film> findAll();

    @Select("select * from mm_film where id=#{id}")
    Film getFilm(int id);

    @Delete("delete from mm_film where id=#{id}")
    int delete(int id);

    @Insert("insert into mm_film (id,name,url,length,releaseTime,endTime,desc)values(#{id},#{name},#{url},#{length},#{releaseTime},#{endTime},#{desc})")
    int save(Film film);

    @Update("update mm_film set id=#{id},name=#{name},url=#{url},length=#{length},releaseTime=#{releaseTime},endTime=#{endTime},desc=#{desc}")
    int update(Film film);
}
